<?php
/**
 * Created by PhpStorm.
 * User: jinzhao
 * Date: 16-8-14
 * Time: 下午9:49
 */
class MY_Controller extends CI_Controller{
   public function __construct()
   {
      parent::__construct();

      $this->load->helper('form');
      $this->load->model('user_model');
      
      
      $email = $this->session->userdata('email');
      if ($email === false){
         redirect('login');
      }
      //先检查有没有登录
      $result = $this->user_model->get_by_email($email);
      if ($this->session->userdata('rand') !== $result['rand']){
         redirect('login');
      }
      if ($result['active'] !== '1'){
         redirect('account/active');
      }
   }
}